@import "../variables";

.filtered-search-box {
  position: relative;
  flex: 1;
  display: flex;
  width: 100%;
  min-width: 0;
  line-height: 24px;
  border: 1px solid #e5e5e5;
  background-color: #fff;

  .tokens-container {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    padding-left: 12px;
    position: relative;
    margin: 0;
  }
  .input-token {
    flex: 1;
    min-width: 64px;
  }
  .ui.search.dropdown {
    .search.filtered-search {
      width: 100%;
      z-index: initial;
      position: relative;
      line-height: 24px;
      padding: 6px 25px 6px 0;
      border: 0;
      outline: none;
    }
  }
  .clear-search,
  .custom-button {
    border: 0;
    z-index: 1;
    outline: none;
    color: #c4c4c4;
    background: #fff;

    &:hover {
      color: #444;
    }
  }
  .search-tips {
    pointer-events: none;
    color: #bbb !important;
    padding: 11px 13px !important;
  }
  .menu.transition.visible {
    &.with-tabs {
      min-height: 240px;
    }
  }
  .ui.dropdown .filter-items {
    > .item {
      min-width: 240px;

      &.history-item {
        max-width: 320px;
        white-space: normal;
      }
    }
    .item-icon {
      margin-right: 0.78571429rem;
    }
    .item-fixed {
      display: block !important;
    }
    .item-keywords {
      display: none;
    }
    .ui.loader {
      margin-right: 0.8em;
    }
  }
  &.is-empty {
    .clear-search,
    .custom-button {
      display: none;
    }
  }
  &.focus {
    border-color: $primary-color;
    box-shadow: 0 0 4px rgba($primary-color, 0.4);
  }
  &.disabled {
    position: relative;
    pointer-events: none;
    
    &::before {
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      content: ' ';
      z-index: 10;
      position: absolute;
      background: rgba(#fff, 0.8);
    }
  }
  .hidden {
    display: none;
  }
  .input-filter-token {
    .menu > .message {
      display: none;
    }
  }
  .item.hide {
    display: none !important;
  }
  .tabs-wrapper {
    display: flex;
    padding: 0 !important;
    margin: 0 !important;
    background-color: #f3f3f3;
    border-top: 1px solid #f3f3f3;
  }
  .tab {
    flex: 1;
    display: inline-block;
    text-align: center;
    padding: 8px 0;
    color: #bbb;
    font-weight: 500;
    cursor: pointer;
  }
  .tab.active {
    background-color: #fff;
  }
}
.filtered-search-box-input-container {
  flex: 1;
  position: relative;
  min-width: 0;
}
.filtered-search-token,
.filtered-search-term {
  display: flex;
  flex-shrink: 0;
  max-width: 100%;
  margin-top: 4px;
  margin-bottom: 4px;
  white-space: nowrap;

  .name {
    background-color: #f8f8f8;
    color: rgba(0,0,0,0.55);
    border-radius: 2px 0 0 2px;
    margin: 1px 1px 1px 0;
    text-transform: capitalize;
  }
  .value-container {
    background-color: #f0f0f0;
    color: rgba(0,0,0,0.85);
    border-radius: 0 2px 2px 0;
    margin: 1px 1px 1px 0;
    padding-right: 8px;

    &:last-child {
      margin-right: 5px;
    }
    &.has-color {
      color: #fff;
    }
  }
  .item-icon {
    margin-right: 0.5rem;
  }
  .item-image {
    width: 20px;
    height: 20px;
    vertical-align: top;
    margin-top: 1px;

    &.ui.avatar.image {
      width: 20px;
      height: 20px;
    }
  }
  .name, .value {
    display: inline-block;
    padding: 2px 7px;
  }
  .remove-token {
    display: inline-block;
    padding-left: 4px;
    padding-right: 0;
  }
  .selectable {
    display: flex;
    flex-wrap: wrap;
  }
  [role="button"] {
    -webkit-appearance: inherit;
    cursor: pointer;
  }
  &:hover {
    .name {
      background-color: #ebebeb;
    }
    .value-container {
      background-color: #dadada;
    }
  }
}
.filtered-search-term {
  .name {
    color: #000;
    text-transform: none;
    background-color: transparent;
  }
  &:hover .name {
    background-color: transparent;
  }
}

.ui.form {
  .filtered-search-box {
    .filtered-search {
      border: 0;
      padding-left: 0;
    }
  }
}
